home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 187 < prev    next >
Encoding:
Text File  |  1996-08-06  |  2.4 KB  |  86 lines

  1. Newsgroups: comp.std.c
  2. Path: news.sprintlink.net!news1!juggler
  3. From: juggler@iquest.net (Phil Paxton)
  4. Subject: Re: How to calculate the Holy Easter.
  5. X-Nntp-Posting-Host: dorite.iquest.net
  6. Message-ID: <juggler.822536373@iquest.net>
  7. Sender: news@iquest.net (News Admin)
  8. Organization: IQuest Internet, Inc.
  9. X-Newsreader: NN version 6.5.0 #9 (NOV)
  10. References: <4e5kmh$2g9@leporello.cs.unibo.it>
  11. Date: Thu, 25 Jan 1996 02:19:33 GMT
  12.  
  13. chierici@cs.unibo.it (Andrea Chierici) writes:
  14.  
  15. >Hi, can anybody send me a C function to calculate the Easter of every year?
  16. >Thanks in advance,
  17. >            Andrea.
  18.  
  19. This was floating about the 'net:
  20.  
  21. Path: dorite!news.sprintlink.net!gatech!news.mathworks.com!news.kei.com!simtel!zippo.uwasa.fi!poiju.uwasa.fi!not-for-mail
  22. From: A.Timmerman@beta.hsholland.nl (Abe Timmerman)
  23. Newsgroups: comp.lang.pascal
  24. Subject: Easter-date
  25. Date: 24 May 1995 12:29:11 -0000
  26. Organization: Hogeschool Holland Sector Beta
  27. Lines: 47
  28. Sender: ts@poiju.uwasa.fi
  29. Approved: news@poiju.uwasa.fi
  30. Message-ID: <ts9505241228.4174@poiju.uwasa.fi>
  31. NNTP-Posting-Host: poiju.uwasa.fi
  32. Summary: Reposted by Timo Salmi
  33.  
  34. I saw the message about the easter-date program and knew I had an
  35. algorithm somewhere.
  36.  
  37. This is the algorithm Gauss published in 1800 to calculate Easter-date.
  38. The notes in my textbook stated that the earliest date for Easter is March 22, and
  39. the latest date is April 25.
  40.  
  41. Here's a pascal procedure for the Gauss-Easter algorithm:
  42. ------------------------------------------------------------
  43. procedure Easter(var Month, Day: Integer; Year: Integer);
  44. { Based on the formulas/algorithm published bij Gauss in 1800 }
  45. var a, b, c, d, e, f, k, m, n, p, q: Integer;
  46. begin
  47.   a := Year mod 19;
  48.   b := Year mod 4;
  49.   c := Year mod 7;
  50.   k := Year div 100;
  51.   p := k div 3;
  52.   q := k - k div 4;
  53.   m := (q - p + 15) mod 30;
  54.   n := (q + 4) mod 7;
  55.   d := (19*a + m) mod 30;
  56.   e := (2*b + 4*c + 6*d + n) mod 7;
  57.   f := d + e - 9;
  58.   if f <= 0 then
  59.     begin
  60.       Month := 3;
  61.       Day := 31 + f;
  62.     end
  63.   else
  64.     begin
  65.       Month := 4;
  66.       if f = 26 then Day := 19
  67.       else if (f = 25) and (d = 28) then Day := 18
  68.       else Day := f;
  69.     end;{ else }
  70. end;{ Easter }
  71.  
  72. Greetings,
  73.  
  74. Abe Timmerman
  75. Hogeschool Holland
  76. (HHIT: Center for education and Information Technology)
  77. The Netherlands
  78. Email:A.Timmerman@Beta.hsholland.nl
  79.  
  80. (And remeber...)
  81.  
  82.  
  83. --
  84.  ------------------------------------
  85.  Phil Paxton :: Fishers, Indiana, USA
  86.